home *** CD-ROM | disk | FTP | other *** search
/ How Many Bugs in a Box / How Many Bugs in a Box.cdr / bugs / act7 / 00028.ls < prev    next >
Encoding:
Text File  |  1995-03-28  |  7.3 KB  |  268 lines

  1. on animateall
  2.   global sblist
  3.   if count(sblist) > 0 then
  4.     repeat with xxx = 1 to count(sblist)
  5.       animate(getAt(sblist, xxx))
  6.     end repeat
  7.   end if
  8. end
  9.  
  10. on initgame
  11.   global WhichBug, prisoners, buglist
  12.   generatebugs()
  13.   set prisoners to [:]
  14.   repeat with xxx = 1 to count(buglist)
  15.     addProp(prisoners, getPropAt(buglist, xxx), 0)
  16.   end repeat
  17.   set WhichBug to 1
  18. end
  19.  
  20. on catchbug chanofme, feedme
  21.   global sblist, bugcaptive, captivechannel, mybugsound
  22.   set captivechannel to chanofme
  23.   set bugcaptive to feedme
  24.   settask(bugcaptive, #caught)
  25.   set thingy to getbugtype(bugcaptive)
  26.   if (thingy < 1) or (thingy > 13) then
  27.     exit
  28.   end if
  29.   set mybugsound to "bugsound" & thingy
  30. end
  31.  
  32. on getoutbug
  33.   global sblist, buglist, bugcast, prisoners, tablecast, genericbug, bugcaptive, mybugsound
  34.   set stiger to the clickOn - 5
  35.   if count(sblist) > 16 then
  36.     exit
  37.   end if
  38.   if getAt(prisoners, stiger) > 0 then
  39.     setAt(prisoners, stiger, getAt(prisoners, stiger) - 1)
  40.     repeat with xxx = 1 to count(prisoners)
  41.       puppetSprite(xxx + 5, 1)
  42.       if getAt(prisoners, xxx) > 0 then
  43.         set the castNum of sprite (5 + xxx) to getAt(tablecast, getPropAt(prisoners, xxx)) + 10 - getAt(prisoners, xxx)
  44.         next repeat
  45.       end if
  46.       set the castNum of sprite (5 + xxx) to getAt(tablecast, 13) - 1
  47.     end repeat
  48.     set xxx to freechan()
  49.     sactivate(xxx, genericbug)
  50.     set bugtype to getPropAt(prisoners, stiger)
  51.     set the castNum of sprite xxx to getAt(bugcast, bugtype)
  52.     set the locH of sprite xxx to the mouseH
  53.     set the locV of sprite xxx to the mouseV
  54.     set spawn to birth(script "bughive", xxx, bugtype)
  55.     set bugcaptive to spawn
  56.     addProp(sblist, xxx, spawn)
  57.     settask(spawn, #return)
  58.     dontPassEvent()
  59.   end if
  60. end
  61.  
  62. on pulloutnew zarniwhoop
  63.   global sblist, buglist, bugcast, prisoners, tablecast, genericbug, bugcaptive, mybugsound, captivechannel
  64.   set stiger to zarniwhoop - 11
  65.   set xxx to freechan()
  66.   sactivate(xxx, genericbug)
  67.   set bugtype to getPropAt(buglist, stiger)
  68.   set the castNum of sprite xxx to getAt(bugcast, bugtype)
  69.   set the locH of sprite xxx to the mouseH
  70.   set the locV of sprite xxx to the mouseV
  71.   set spawn to birth(script "bughive", xxx, bugtype)
  72.   set bugcaptive to spawn
  73.   set captivechannel to xxx
  74.   addProp(sblist, xxx, spawn)
  75.   settask(spawn, #caught)
  76.   set mybugsound to "bugsound" & bugtype
  77.   dontPassEvent()
  78. end
  79.  
  80. on pulloutnewold zarniwhoop
  81.   global buglist
  82.   set stiger to zarniwhoop - 11
  83.   addbug(getPropAt(buglist, stiger))
  84. end
  85.  
  86. on releasebug
  87.   global bugcaptive
  88.   settask(bugcaptive, #return)
  89. end
  90.  
  91. on InTheCagePal
  92.   global bugcaptive, buglist, bugnumber, WhichBug, prisoners, sblist, captivechannel, bgroup, tablecast, closedbox
  93.   set whichcage to random(count(buglist))
  94.   if getaProp(buglist, getbugtype(bugcaptive)) then
  95.     set whogot to getbugtype(bugcaptive)
  96.     if getaProp(prisoners, whogot) < 10 then
  97.       settask(bugcaptive, #killhim)
  98.       puppetSound("drop1")
  99.       updateStage()
  100.       animateall()
  101.       setaProp(prisoners, whogot, getaProp(prisoners, whogot) + 1)
  102.       repeat with xxx = 1 to count(prisoners)
  103.         puppetSprite(xxx + 5, 1)
  104.         if getAt(prisoners, xxx) > 0 then
  105.           set the castNum of sprite (5 + xxx) to getAt(tablecast, getPropAt(prisoners, xxx)) + 10 - getAt(prisoners, xxx)
  106.         end if
  107.       end repeat
  108.       puppetSprite(WhichBug, 0)
  109.       puppetSprite(22, 1)
  110.     else
  111.       settask(bugcaptive, #frighten)
  112.     end if
  113.   else
  114.     settask(bugcaptive, #frighten)
  115.   end if
  116.   set the castNum of sprite 11 to closedbox
  117. end
  118.  
  119. on endgame
  120.   global prisoners, buglist, game7level, ogre, bugout, rewardlist
  121.   if bugout = 1 then
  122.     set bugout to 0
  123.   else
  124.     exit
  125.   end if
  126.   if (game7level < 3) and inside(the clickLoc, rect(the left of sprite 2, the top of sprite 2, the right of sprite 2, the bottom of sprite 2)) then
  127.     saylist()
  128.     exit
  129.   end if
  130.   set stiglits to the frame
  131.   puppetSound(0)
  132.   if prisoners = buglist then
  133.     set the mouseout of ogre to 0
  134.     talkyou("pos0" & random(7))
  135.     set the mouseout of ogre to 1
  136.     go(stiglits)
  137.     haremscarem()
  138.     repeat with xxx = 1 to 48
  139.       puppetSprite(xxx, 0)
  140.     end repeat
  141.     updateStage()
  142.     if not listp(rewardlist) then
  143.       set rewardlist to []
  144.     end if
  145.     if count(rewardlist) < 2 then
  146.       set smellit to [1, 2, 3, 4, 7, 5, 6]
  147.       repeat while count(smellit)
  148.         set thing to random(count(smellit))
  149.         add(rewardlist, getAt(smellit, thing))
  150.         deleteAt(smellit, thing)
  151.       end repeat
  152.     end if
  153.     set thing to random(count(rewardlist))
  154.     set whogo to getAt(rewardlist, thing)
  155.     deleteAt(rewardlist, thing)
  156.     go("reward" & whogo)
  157.     exit
  158.   else
  159.     if game7level <> 3 then
  160.       talkyou("neg0" & random(4))
  161.       repeat with xxx = 1 to count(prisoners)
  162.         if getAt(prisoners, xxx) < getAt(buglist, xxx) then
  163.           talkyou("<" & getPropAt(prisoners, xxx))
  164.           exit repeat
  165.           go(stiglits)
  166.           exit
  167.           next repeat
  168.         end if
  169.         if getAt(prisoners, xxx) > getAt(buglist, xxx) then
  170.           talkyou(">" & getPropAt(prisoners, xxx))
  171.           exit repeat
  172.           go(stiglits)
  173.           exit
  174.         end if
  175.       end repeat
  176.     else
  177.       saylist()
  178.     end if
  179.   end if
  180.   go(stiglits)
  181. end
  182.  
  183. on haremscarem
  184.   global sblist
  185.   puppetSound("scuttle")
  186.   repeat with xxx = 1 to count(sblist)
  187.     settask(getAt(sblist, xxx), #frighten)
  188.   end repeat
  189.   repeat with xxx = 1 to 30
  190.     animateall()
  191.     updateStage()
  192.   end repeat
  193.   repeat with xxx = 1 to count(sblist)
  194.     settask(getAt(sblist, xxx), #killhim)
  195.   end repeat
  196.   animateall()
  197. end
  198.  
  199. on alcatraz
  200.   global sblist
  201.   repeat with xxx = 1 to count(sblist)
  202.     settask(getAt(sblist, xxx), #escaping)
  203.     setdest(getAt(sblist, xxx), 354, 451)
  204.   end repeat
  205.   repeat with xxx = 1 to 26
  206.     animateall()
  207.     updateStage()
  208.   end repeat
  209.   repeat with xxx = 1 to count(sblist)
  210.     settask(getAt(sblist, xxx), #killhim)
  211.   end repeat
  212.   animateall()
  213. end
  214.  
  215. on makeendbugs
  216.   global sblist, prisoners, genericbug, bugcast
  217.   set sblist to [:]
  218.   repeat with xxx = 28 to 39
  219.     sactivate(xxx, genericbug)
  220.     set whobug to random(count(prisoners))
  221.     set bugtype to getPropAt(prisoners, whobug)
  222.     if bugtype < 7 then
  223.       set hoffset to 3
  224.     else
  225.       if bugtype < 11 then
  226.         set hoffset to 6
  227.       else
  228.         set hoffset to 16
  229.       end if
  230.     end if
  231.     set the castNum of sprite xxx to getAt(bugcast, bugtype) + hoffset
  232.     set the locH of sprite xxx to the locH of sprite (39 + whobug) - 50 + random(100)
  233.     set the locV of sprite xxx to the locV of sprite (39 + whobug) - 30 + random(60)
  234.     set spawn to birth(script "bughive", xxx, bugtype)
  235.     addProp(sblist, xxx, spawn)
  236.   end repeat
  237. end
  238.  
  239. on openscroll
  240.   set stiger to the number of cast "scroll1"
  241.   puppetSprite(2, 1)
  242.   startTimer()
  243.   repeat with xxx = 0 to 5
  244.     repeat while the timer < 10
  245.       updateStage()
  246.     end repeat
  247.     set the castNum of sprite 2 to stiger + xxx
  248.     startTimer()
  249.   end repeat
  250.   set the castNum of sprite 2 to the number of cast "scroll6"
  251.   updateStage()
  252. end
  253.  
  254. on closescroll
  255.   set stiger to the number of cast "scroll1"
  256.   startTimer()
  257.   repeat with xxx = 5 down to 0
  258.     repeat while the timer < 10
  259.       updateStage()
  260.     end repeat
  261.     set the castNum of sprite 2 to stiger + xxx
  262.     startTimer()
  263.   end repeat
  264.   set the castNum of sprite 2 to the number of cast "scroll0"
  265.   set the locH of sprite 2 to -150
  266.   updateStage()
  267. end
  268.